# Maintainer: Peter Klotz <peter.klotz99@gmail.com>
# Contributor: fkxxyz <fkxxyz@163.com>

pkgname=uex4
pkgver=4.0.0.4
pkgrel=1
pkgdesc="UltraEdit is a powerful text editor."
arch=('x86_64')
url="https://download.cnet.com/UltraEdit-for-Linux/3000-2352_4-75713536.html"
license=('custom')
source=('local://uex-4.0.0.4_amd64.tar.gz')
md5sums=('6ff288e4f8eb533095f7cfb81e9182f9')
depends=('libpng12' 'libsm' 'gtk2')

build() {
  sed -i \
    -e 's/Name=UltraEdit/Name=UltraEdit4/' \
    -e 's/Exec=uex /Exec=uex4 /' \
    -e 's/Icon=ue.png/Icon=ue4.png/' \
    "${srcdir}/uex/share/uex/uex.desktop"
}

package() {
  install -d "${pkgdir}/opt" "${pkgdir}/usr/bin" "${pkgdir}/usr/share/pixmaps" "${pkgdir}/usr/share/applications" "${pkgdir}/usr/share/licenses/${pkgname}"

  cp -R "${srcdir}/uex" "${pkgdir}/opt/uex4"
  ln -s "/opt/uex4/bin/uex" "${pkgdir}/usr/bin/uex4"
  ln -s "/opt/uex4/share/uex/ue.png" "${pkgdir}/usr/share/pixmaps/ue4.png"
  ln -s "/opt/uex4/share/uex/uex.desktop" "${pkgdir}/usr/share/applications/uex4.desktop"
  ln -s "/opt/uex4/share/doc/uex/copyright" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

